﻿<UserControl
    x:Class="Results.Views.TournamentView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300"
    d:DesignWidth="400"
    xmlns:Icons="clr-namespace:Results.Icons">
    <Grid
        x:Name="LayoutRoot"
        Background="{x:Null}">
        <Grid.RowDefinitions>
            <RowDefinition
                Height="Auto" />
            <RowDefinition
                Height="*" />
        </Grid.RowDefinitions>
        <StackPanel
            Orientation="Horizontal">
            <Icons:TournamentIcon
                Width="50"
                Height="50"
                Margin="4" />
            <StackPanel
                Orientation="Vertical">
                <StackPanel
                    Orientation="Horizontal">
                    <TextBlock
                        Text="{Binding Name}"
                        FontSize="18" />
                </StackPanel>
                <StackPanel
                    Orientation="Horizontal">
                    <TextBlock
                        Text="Course: " />
                    <TextBlock
                        Text="{Binding Course}" />
                </StackPanel>
                <StackPanel
                    Orientation="Horizontal">
                    <TextBlock
                        Text="Location: " />
                    <TextBlock
                        Text="{Binding Location}" />
                </StackPanel>
                <StackPanel
                    Orientation="Horizontal">
                    <TextBlock
                        Text="Dates: " />
                    <TextBlock
                        Text="{Binding FormattedDates}" />
                </StackPanel>
                <StackPanel
                    Orientation="Horizontal">
                    <TextBlock
                        Text="Website: " />
                    <HyperlinkButton
                        NavigateUri="{Binding Website}">
                        <TextBlock
                            Text="{Binding Website}" />
                    </HyperlinkButton>
                </StackPanel>
                <StackPanel
                    Orientation="Horizontal">
                    <TextBlock
                        Text="Season: " />
                    <TextBlock
                        Text="{Binding Season}" />
                </StackPanel>
                <StackPanel
                    Orientation="Horizontal">
                    <TextBlock
                        Text="Weather: " />
                    <TextBlock
                        Text="{Binding Weather}" />
                </StackPanel>
            </StackPanel>
        </StackPanel>
        <Grid
            Grid.Row="2">
            <Grid.RowDefinitions>
                <RowDefinition
                    Height="Auto" />
                <RowDefinition
                    Height="*" />
            </Grid.RowDefinitions>
            <StackPanel
                x:Name="Header"
                Margin="5,0,0,0"
                Orientation="Horizontal"
                HorizontalAlignment="Left">
                <StackPanel.Background>
                    <LinearGradientBrush
                        EndPoint="0.5,1"
                        StartPoint="0.5,0">
                        <GradientStop
                            Color="#FF9DE271"
                            Offset="0" />
                        <GradientStop
                            Color="#FF969696"
                            Offset="1" />
                    </LinearGradientBrush>
                </StackPanel.Background>
                <TextBlock
                    Text="Player"
                    VerticalAlignment="Center"
                    Width="200" />
                <TextBlock
                    Text="Grad"
                    VerticalAlignment="Center"
                    Width="50" />
                <TextBlock
                    Text="Round1"
                    VerticalAlignment="Center"
                    Width="50" />
                <TextBlock
                    Text="Round2"
                    VerticalAlignment="Center"
                    Width="50" />
                <TextBlock
                    Text="Total"
                    VerticalAlignment="Center"
                    Width="50" />
                <TextBlock
                    Text="Place"
                    VerticalAlignment="Center"
                    Width="50" />
                <TextBlock
                    Text="Points"
                    VerticalAlignment="Center"
                    Width="50" />
            </StackPanel>
            <ScrollViewer
                Grid.Row="2"
                HorizontalAlignment="Left">
                <ItemsControl
                    ItemsSource="{Binding Results}">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <Button
                                Command="{Binding PlayerSelected}">
                                <StackPanel
                                    Orientation="Horizontal"
                                    HorizontalAlignment="Left">
                                    <TextBlock
                                        Text="{Binding Player}"
                                        VerticalAlignment="Center"
                                        Width="200" />
                                    <TextBlock
                                        Text="{Binding GraduationYear}"
                                        VerticalAlignment="Center"
                                        Width="50" />
                                    <TextBlock
                                        Text="{Binding Round1}"
                                        VerticalAlignment="Center"
                                        Width="50" />
                                    <TextBlock
                                        Text="{Binding Round2}"
                                        VerticalAlignment="Center"
                                        Width="50" />
                                    <TextBlock
                                        Text="{Binding Total}"
                                        VerticalAlignment="Center"
                                        Width="50" />
                                    <TextBlock
                                        Text="{Binding Place}"
                                        VerticalAlignment="Center"
                                        Width="50" />
                                    <TextBlock
                                        Text="{Binding Points}"
                                        VerticalAlignment="Center"
                                        Width="50" />
                                </StackPanel>
                            </Button>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                    <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>
                            <StackPanel
                                Orientation="Vertical" />
                        </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>
                </ItemsControl>
            </ScrollViewer>
        </Grid>
    </Grid>
</UserControl>
